<?php

namespace App\Http\Requests;

use App\Models\WeChat;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class WeChatRequest extends FormRequest
{

    public function authorize()
    {
        return auth()->check();
    }

    public function rules()
    {
        return [
            'title' => ['required'],
            'token' => ['required'],
            'appID' => ['required', Rule::unique('we_chats')->ignore(request('wechat')->id)],
            'type' => ['required'],
            'appsecret' => ['required'],
            'wechat_id' => [Rule::unique('we_chats')->ignore(request('wechat')->id)]
        ];
    }
}
